<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    div {
        width: 700px;
        height: 500px;
    }
</style>
<body>
    <div>
        <img src="./age/图片3.jpg" style="width: 700px; height:500px">
    </div>
    <script>
        var img = document.getElementsByTagName('img')[0];
        const imgArr = ['图片1.jpg','图片2.jpg','图片3.jpg','图片4.jpg','图片5.jpg','图片6.jpg','图片7.jpg',];
        var count = 0;
        function fn() {
            console.log(count);
            if (count < 6) {
                count++;
            } else {
                count = 0;
            }

            img.src = "./age/" + imgArr[count];
            return setTimeout(fn, 500);
        }
        setTimeout(fn, 2000);
    </script>
</body>
</html>